import request from '../utils/request'

export const article = ({ channel_id, timestamp }) => {

    return request({
        url: '/v1_0/articles',
        method: 'get',
        // 因为是get请求，所以参数写params
        params: {
            channel_id,
            timestamp,
        }
    })
}
export const articleInfo = (id) => {
        return request({
            url: `/v1_0/articles/${id}`
        })

    }
    // 封装一个点赞接口
export const zan = (data) => {
        return request({
            url: "/v1_0/article/likings",
            method: 'post',
            data
        })
    }
    // 封装一个取消点赞接口
export const unzan = (id) => {
    return request({
        url: "/v1_0/article/likings/" + id,
        method: 'delete',

    })
}

export const unlike = (data) => {
    return request({
        url: '/v1_0/article/dislikes',
        method: 'post',
        data
    })
}
export const cancelUnlike = (id) => {
    return request({
        url: "/v1_0/article/dislikes/:target" + id,
        method: 'delete'
    })
}